package com.bkgy.modular.oneTouchQuality.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bkgy.modular.oneTouchQuality.entity.OneTouchQuality;
import com.bkgy.modular.oneTouchQuality.mapper.OneTouchQualityMapper;
import com.bkgy.modular.oneTouchQuality.service.OneTouchQualityService;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ZhuHongKai
 * @version 1.0
 * @ClassName OneTouchQualityServiceImpl
 * @date 2022/12/16 13:38
 */
@Service
public class OneTouchQualityServiceImpl extends ServiceImpl<OneTouchQualityMapper,OneTouchQuality> implements OneTouchQualityService {
    @Resource
    private OneTouchQualityMapper oneTouchQualityMapper;
    @Override
    public ResultData queryData(JSONObject jsonObject) {
        String coldCoilId = jsonObject.getString("coldCoilId");
        if (coldCoilId != null && coldCoilId != "") {
            List<OneTouchQuality> data = oneTouchQualityMapper.findByData(coldCoilId);
            return ResultData.ResultDataSuccess(data, data.size());
        } else {
            return ResultData.ResultDataFaultSelf("参数不得为空",-1);
        }
    }

    @Override
    public ResultData queryData2(JSONObject jsonObject) {
        String coldCoilId = jsonObject.getString("coldCoilId");
        if (coldCoilId != null && coldCoilId != "") {
            List<OneTouchQuality> data = oneTouchQualityMapper.findByData2(coldCoilId);
            return ResultData.ResultDataSuccess(data, data.size());
        } else {
            return ResultData.ResultDataFaultSelf("参数不得为空",-1);
        }
    }
}
